<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>

    <style>
        .error{
            color: #F00;
            margin-left: 10px;
        }
    </style>
</head>
<body>
<h1>注册界面</h1>

<h3> <a href="${pageContext.request.contextPath}/login.jsp">登录</a>   </h3>

<p style="text-align: center;color: red">${error}</p>
<form action="${pageContext.request.contextPath}/regist" method="post" enctype="multipart/form-data">

    <table border="1" cellspacing="0" cellpadding="10" align="center">

        <tr>
            <td>用户名</td>
            <td> <input type="text" name="username" value="${user.username}" /> <span class="error">${map.username}</span> </td>
        </tr>

        <tr>
            <td>密码</td>
            <td><input type="password" name="password" /><span class="error">${map.password}</span></td>
        </tr>

        <tr>
            <td>照片</td>
            <td><input type="file" name="picurl" /> <span class="error">${map.picurl}</span></td>
        </tr>

        <tr>
            <td>性别</td>
            <td><input type="radio" name="gender" value="nan"
            ${user.gender == 'nan' ? 'checked':'' }
            />男
                <input type="radio" name="gender" value="nv"
                ${user.gender == 'nv' ? 'checked':'' }/>女<span class="error">${map.gender}</span></td>
        </tr>

        <tr>
            <td>爱好</td>
            <td><input type="checkbox" name="hobby" value="basketball"
                 ${fn:contains(user.hobby,'basketball')?'checked':''}
                />篮球
                <input type="checkbox" name="hobby" value="music"
                ${fn:contains(user.hobby,'music')?'checked':''}
                />音乐
                <input type="checkbox" name="hobby" value="dance"
                ${fn:contains(user.hobby,'dance')?'checked':''}
                />跳舞
                <input type="checkbox" name="hobby" value="football"
                ${fn:contains(user.hobby,'football')?'checked':''}
                />足球

                <span class="error">${map.hobby} </span>
            </td>
        </tr>

        <tr>
            <td>城市
            </td>

            <td>
                <select name="city">
                    <option value="">无</option>
                    <option value="shijiazhuang" ${user.city == 'shijiazhuang'?'selected':''}>石家庄</option>
                    <option value="beijing" ${user.city == 'beijing'?'selected':''}>北京</option>
                    <option value="shanghai" ${user.city == 'shanghai'?'selected':''}>上海</option>
                    <option value="newYork" ${user.city == 'newYork'?'selected':''}>纽约</option>
                </select>
                <span class="error">${map.city}</span>
            </td>
        </tr>

        <tr>
            <td>自我介绍</td>

            <td>
                <textarea rows="10" cols="40" name="introduce">${user.introduce}</textarea>
                <span class="error">${map.introduce}</span>
            </td>
        </tr>

        <tr>
            <td>验证码</td>
            <td><input type="text" name="yan" />
            <img src="${pageContext.request.contextPath}/yanzheng" onclick="huan(this)">
            </td>
        </tr>

        <tr>
            <td colspan="2" align="center"><input type="submit" value="注册"/></td>
        </tr>
    </table>


</form>
</body>

<script>

    function huan(obj) {
        obj.src = "${pageContext.request.contextPath}/yanzheng?shijian="+new Date().getTime();
    }
</script>
</html>
